package com.ibm.mall.action;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ibm.mall.base.BaseAction;
import com.ibm.mall.model.Commodity;
import com.ibm.mall.model.CommodityClass;
import com.ibm.mall.model.PageBean;
import com.ibm.mall.model.User;
import com.ibm.mall.util.QueryHelper;
import com.opensymphony.xwork2.ActionContext;

@Controller
@Scope("prototype")
public class CustomerHomeAction extends BaseAction<User> {
	
	private static final long serialVersionUID = 1L;
	
	public String index() {
		List<CommodityClass> commodityClassList=commodityClassService.getTopCommodityClass();
		ActionContext.getContext().put("commodityClassList", commodityClassList);
		QueryHelper queryHelper=new QueryHelper(Commodity.class, "c")
			.addCondition("c.status=?", (short)0)
			.addOrderProperty("insertTime", false);
		PageBean commodityPage=commodityService.getPageBean(1, 8, queryHelper);
		ActionContext.getContext().put("commodityPage", commodityPage);
		return "index";
	}

}
